<script setup>
const emits = defineEmits(['deleteItems'])
const props = defineProps({
    list: { type: Array, default: [] },//列表数据
    loadTip: { type: String, default: '' }//数据提示信息
})
const router = useRouter()
const route = useRoute()
</script>

<template>
    <div>
        <el-table class="nopage" :empty-text="props.loadTip" :data="props.list">
            <el-table-column prop="id" label="Id" width="80" />
            <el-table-column prop="names" label="类型名称" width="500" />
            <el-table-column label="操作" width="200">
                <template #default="scope">
                    <el-link class="mr10" type="primary"
                        @click="router.push('/articleType/edit?id=' + scope.row.id + '&back=' + encodeURIComponent(route.fullPath))">
                        <span v-if="$power('/articleType/info') && $power('/articleType/edit')">修改</span>
                        <span v-else-if="$power('/articleType/info')">详情</span>
                    </el-link>
                    <el-link class="mr10" type="primary"
                        @click="router.push('/articleType/edit?fid=' + scope.row.id + '&back=' + encodeURIComponent(route.fullPath))"
                        v-if="$power('/articleType/edit')">添加子级</el-link>
                    <el-popconfirm :hide-after="0" width="200" :title="'确定要删除【' + scope.row.name + '】吗?'"
                        @confirm="emits('deleteItems', scope.row.id)" v-if="$power('/articleType/delete')">
                        <template #reference>
                            <el-link type="danger">删除</el-link>
                        </template>
                    </el-popconfirm>
                </template>
            </el-table-column>
            <el-table-column prop="" label="" />
        </el-table>
    </div>
</template>

<style scoped lang="scss"></style>
